package org.aplikator.server.persistence;

import org.aplikator.client.data.Record;
import org.aplikator.server.Context;

public interface PersisterTriggers {

    Record beforeCreate(Record record, Context ctx);

    Record afterCreate(Record record, Context ctx);

    Record beforeUpdate(Record record, Context ctx);

    Record afterUpdate(Record record, Context ctx);

    Record beforeDelete(Record record, Context ctx);

    Record afterDelete(Record record, Context ctx);

    public static class Default implements PersisterTriggers{

        @Override
        public Record beforeCreate(Record record, Context ctx) {
            return record;
        }

        @Override
        public Record afterCreate(Record record, Context ctx) {
            return record;
        }

        @Override
        public Record beforeUpdate(Record record, Context ctx) {
            return record;
        }

        @Override
        public Record afterUpdate(Record record, Context ctx) {
            return record;
        }

        @Override
        public Record beforeDelete(Record record, Context ctx) {
            return record;
        }

        @Override
        public Record afterDelete(Record record, Context ctx) {
            return record;
        }

    }

}
